package com.portico.dept.solarch

class Client implements Serializable {

  String name ="N/A" ;
  String description ="";
  boolean active = false ;

    static constraints = {
      name blank:false, unique:true
      description maxSize:200
    }

  	Set<Project> getProjects() {
		ClientProject.findAllByClient(this).collect { it.project } as Set
	}


  static Client addClient (Client c) {
    if ( find (c) == null ) {
      c.save();
    }  else find (c) ;
  }
}
